package com.jxpanda.infrastructure.core.constant;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;

/**
 * 常用的一些类型的默认值
 *
 * @author Panda
 */
public class DefaultValueConstant {

    /**
     * 整型
     */
    public static final Byte BYTE = (byte) 0;
    public static final Short SHORT = (short) 0;
    public static final Integer INTEGER = 0;
    public static final Long LONG = 0L;
    /**
     * 浮点型
     */
    public static final Float FLOAT = 0.0F;
    public static final Double DOUBLE = 0.0;
    /**
     * 布尔
     */
    public static final Boolean BOOLEAN = false;
    /**
     * 小数
     */
    public static final BigDecimal BIG_DECIMAL = BigDecimal.ZERO;
    /**
     * 字符串
     */
    public static final String STRING = StringConstant.BLANK;
    /**
     * id
     */
    public static final String ID = StringConstant.ID_DEFAULT;
    /**
     * 日期
     */
    public static final LocalDate LOCAL_DATE = LocalDate.EPOCH;
    public static final LocalTime LOCAL_TIME = LocalTime.MIN;
    public static final LocalDateTime LOCAL_DATE_TIME = DateTimeConstant.DATETIME_9999;
    /**
     * 集合，这些集合都是不可写的
     */
    public static final List<?> LIST = Collections.EMPTY_LIST;
    public static final Set<?> SET = Collections.EMPTY_SET;
    public static final Map<?, ?> MAP = Collections.EMPTY_MAP;
    /**
     * 空对象
     */
    public static final Object OBJECT = new Object();

    /**
     * 常用类型与默认值的哈希表
     */
    @SuppressWarnings("ConstantConditions")
    public static final Map<Class<?>, Object> VALUE_MAP = new HashMap<>() {{
        put(byte.class, BYTE);
        put(short.class, SHORT);
        put(int.class, INTEGER);
        put(long.class, LONG);
        put(float.class, FLOAT);
        put(double.class, DOUBLE);
        put(boolean.class, DOUBLE);
        put(Byte.class, BYTE);
        put(Short.class, SHORT);
        put(Integer.class, INTEGER);
        put(Long.class, LONG);
        put(Float.class, FLOAT);
        put(Double.class, DOUBLE);
        put(BigDecimal.class, BIG_DECIMAL);
        put(String.class, STRING);
        put(Boolean.class, BOOLEAN);
        put(List.class, LIST);
        put(Set.class, SET);
        put(Map.class, MAP);
        put(LocalDate.class, LOCAL_DATE);
        put(LocalTime.class, LOCAL_TIME);
        put(LocalDateTime.class, LOCAL_DATE_TIME);
    }};

}
